; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f | FileCheck %s
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512vl | FileCheck %s
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512bw | FileCheck %s
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512dq | FileCheck %s

define void @PR53842() {
; CHECK-LABEL: PR53842:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    vpxor %xmm0, %xmm0, %xmm0
; CHECK-NEXT:    vpxor %xmm1, %xmm1, %xmm1
; CHECK-NEXT:    .p2align 4, 0x90
; CHECK-NEXT:  .LBB0_1: # %vector.body
; CHECK-NEXT:    # =>This Inner Loop Header: Depth=1
; CHECK-NEXT:    vpmovzxbq {{.*#+}} zmm2 = mem[0],zero,zero,zero,zero,zero,zero,zero,mem[1],zero,zero,zero,zero,zero,zero,zero,mem[2],zero,zero,zero,zero,zero,zero,zero,mem[3],zero,zero,zero,zero,zero,zero,zero,mem[4],zero,zero,zero,zero,zero,zero,zero,mem[5],zero,zero,zero,zero,zero,zero,zero,mem[6],zero,zero,zero,zero,zero,zero,zero,mem[7],zero,zero,zero,zero,zero,zero,zero
; CHECK-NEXT:    vextracti64x4 $1, %zmm2, %ymm3
; CHECK-NEXT:    vpcmpeqq %ymm1, %ymm3, %ymm3
; CHECK-NEXT:    vpcmpeqq %ymm1, %ymm2, %ymm2
; CHECK-NEXT:    vinserti64x4 $1, %ymm3, %zmm2, %zmm2
; CHECK-NEXT:    vpsubq %zmm2, %zmm0, %zmm0
; CHECK-NEXT:    jmp .LBB0_1
entry:
  br label %vector.body

vector.body:
  %index = phi i64 [ 0, %entry ], [ 0, %vector.body ]
  %vec.phi = phi <8 x i64> [ zeroinitializer, %entry ], [ %i2, %vector.body ]
  %wide.load23 = load <8 x i8>, ptr undef, align 1
  %i = icmp eq <8 x i8> zeroinitializer, %wide.load23
  %i1 = zext <8 x i1> %i to <8 x i64>
  %i2 = add <8 x i64> %vec.phi, %i1
  br i1 false, label %middle.block, label %vector.body

middle.block:
  %bin.rdx = add <8 x i64> undef, %i2
  unreachable
}

